
package com.shop.cloud.mall.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.common.log.annotation.SysLog;
import com.shop.cloud.mall.common.entity.OrderBill;
import com.shop.cloud.mall.admin.service.OrderBillService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 订单发票
 *
 * @author 
 * @date 2023-04-14 14:07:49
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/orderbill")
@Tag(description = "orderbill", name = "订单发票管理")
public class OrderBillController {

    private final OrderBillService orderBillService;

    /**
     * 订单发票修改
     * @param orderBill 订单发票
     * @return R
     */
    @Operation(summary = "订单发票修改")
    @SysLog("修改订单发票")
    @PutMapping
    @PreAuthorize("@ato.hasAuthority('mall:orderbill:edit')")
    public R updateById(@RequestBody OrderBill orderBill) {
        return R.ok(orderBillService.updateById(orderBill));
    }

	/**
	 * 分页查询
	 * @param page 分页对象
	 * @param orderBill
	 * @return
	 */
	@Operation(summary = "分页查询")
	@GetMapping("/page")
	@PreAuthorize("@ato.hasAuthority('mall:orderbill:index')")
	public R getPage(Page page, OrderBill orderBill) {
		return R.ok(orderBillService.page1(page, orderBill));
	}
}
